package helper

import (
	"encoding/json"
	"io/ioutil"
	"strings"
)

func JsonFileToObject(filePath string, interfacePtr interface{}) error {

	filePath = strings.ReplaceAll(filePath, "\\", "/")
	bytes, err := ioutil.ReadFile(filePath)
	if err != nil {
		return err
	}
	err = json.Unmarshal(bytes, interfacePtr)
	if err != nil {
		//logHelper.Error("配置文件出错,", err)
		return err
	}
	return nil
}
